<div class="editor-row">
	<div class="section gf-form-group" ng-repeat="yaxis in ctrl.panel.yaxes">

		<h5 class="section-heading" ng-show="$index === 0">左边 Y</h5>
		<h5 class="section-heading" ng-show="$index === 1">右边 Y</h5>

		<gf-form-switch class="gf-form" label="Show" label-class="width-6" checked="yaxis.show" on-change="ctrl.render()"></gf-form-switch>

		<div ng-if="yaxis.show">
			<div class="gf-form">
				<label class="gf-form-label width-6">单元</label>
				<div class="gf-form-dropdown-typeahead max-width-20" ng-model="yaxis.format" dropdown-typeahead2="ctrl.unitFormats" dropdown-typeahead-on-select="ctrl.setUnitFormat(yaxis, $subItem)"></div>
			</div>
		</div>

			<div class="gf-form">
				<label class="gf-form-label width-6">比例</label>
				<div class="gf-form-select-wrapper max-width-20">
					<select class="gf-form-input" ng-model="yaxis.logBase" ng-options="v as k for (k, v) in ctrl.logScales" ng-change="ctrl.render()"></select>
				</div>
			</div>

			<div class="gf-form-inline">
				<div class="gf-form">
					<label class="gf-form-label width-6">Y-最小值</label>
					<input type="text" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="yaxis.min" ng-change="ctrl.render()" ng-model-onblur>
				</div>
				<div class="gf-form">
					<label class="gf-form-label width-6">Y-最大值</label>
					<input type="text" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="yaxis.max" ng-change="ctrl.render()" ng-model-onblur>
				</div>
			</div>

		<div ng-if="yaxis.show">
			<div class="gf-form">
				<label class="gf-form-label width-6">小数点</label>
				<input type="number" class="gf-form-input max-width-20" placeholder="auto" empty-to-null bs-tooltip="'覆盖y轴的自动小数精度'" data-placement="right" ng-model="yaxis.decimals" ng-change="ctrl.render()" ng-model-onblur>
			</div>

			<div class="gf-form">
				<label class="gf-form-label width-6">标签</label>
				<input type="text" class="gf-form-input max-width-20" ng-model="yaxis.label" ng-change="ctrl.render()" ng-model-onblur>
			</div>
		</div>
	</div>

	<div class="section gf-form-group" aria-label="X-Axis section">
		<h5 class="section-heading">X-轴</h5>
		<gf-form-switch class="gf-form" label="Show" label-class="width-6" checked="ctrl.panel.xaxis.show" on-change="ctrl.render()"></gf-form-switch>

		<div class="gf-form">
			<label class="gf-form-label width-6">模式</label>
			<div class="gf-form-select-wrapper max-width-15">
				<select class="gf-form-input" ng-model="ctrl.panel.xaxis.mode" ng-options="v as k for (k, v) in ctrl.xAxisModes" ng-change="ctrl.xAxisModeChanged()"> </select>
			</div>
		</div>

		<!-- Series mode -->
		<div class="gf-form" ng-if="ctrl.panel.xaxis.mode === 'series'">
			<label class="gf-form-label width-6">值</label>
      <metric-segment-model property="ctrl.panel.xaxis.values[0]" options="ctrl.xAxisStatOptions" on-change="ctrl.xAxisValueChanged()" custom="false" css-class="width-10" select-mode="true"></metric-segment-model>
		</div>

		<!-- Histogram mode -->
		<div class="gf-form" ng-if="ctrl.panel.xaxis.mode === 'histogram'">
			<label class="gf-form-label width-6">Buckets</label>
			<input type="number" class="gf-form-input max-width-8" ng-model="ctrl.panel.xaxis.buckets" placeholder="auto" ng-change="ctrl.render()" ng-model-onblur bs-tooltip="'buckets数量'" data-placement="right">
		</div>

		<div class="gf-form-inline" ng-if="ctrl.panel.xaxis.mode === 'histogram'">
			<div class="gf-form">
				<label class="gf-form-label width-6">X-最小</label>
				<input type="number" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="ctrl.panel.xaxis.min" ng-change="ctrl.render()" ng-model-onblur>
			</div>
			<div class="gf-form">
				<label class="gf-form-label width-6">X-最大</label>
				<input type="number" class="gf-form-input width-5" placeholder="auto" empty-to-null ng-model="ctrl.panel.xaxis.max" ng-change="ctrl.render()" ng-model-onblur>
			</div>
		</div>

		<div>
			<br/>
			<h5 class="section-heading">Y-轴</h5>
			<gf-form-switch class="gf-form" label="对齐" tooltip="对齐左右Y轴" label-class="width-6" switch-class="width-5" checked="ctrl.panel.yaxis.align" on-change="ctrl.render()"></gf-form-switch>
			<div class="gf-form" ng-show="ctrl.panel.yaxis.align">
				<label class="gf-form-label width-6">
					级别
				</label>
				<input type="number" class="gf-form-input width-5" placeholder="0" ng-model="ctrl.panel.yaxis.alignLevel" ng-change="ctrl.render()" ng-model-onblur bs-tooltip="'Y轴的对齐基于该值，从Y = 0'开始" data-placement="right">
			</div>
		</div>

	</div>

</div>
